package pull;

import helper.ImageData;
import helper.ImageProcessor;

import javax.media.jai.KernelJAI;

import framework.filters.AbstractPullFilter;
import framework.pipes.PullPipe;

/**
 * Apply the erode operation on the given image
 * 
 * @author Wetzel & Rusch
 * 
 */
public class ErodeFilter extends AbstractPullFilter<ImageData> {

	KernelJAI m_kernel;

	public ErodeFilter(PullPipe<ImageData> pullPipe) {
		super(pullPipe);
	}

	public void setKernelData(float[] kernelData, int rows, int columns) {
		m_kernel = new KernelJAI(rows, columns, kernelData);
	}

	@Override
	public void doIt() {
		// Call the erode method
		ImageProcessor ip = ImageProcessor.getInstance();
		m_data.setRoiImage(ip.getErode(m_data.getRoiImage(), m_kernel));
	}

}
